<?php
namespace app\houtai\controller;
use app\houtai\controller\Base;
use think\Controller;
use think\Db;
use think\Session;
class info extends Base
{
    public function info()
    {
    	$data=db('basic')->where('id',1)->find();
    	$this->assign('bas',$data);
        return view();
    }
    public function up_info()
    {
    	$data=$_POST;
    	$res=db('basic')->where('id',1)->update($data);
    	if ($res) {
    		return json_encode([
    			'status'=>1,
    			]);
    	}else{
    		return json_encode([
    			'status'=>0,
    			]);
    	}
    }
    public function up_url()
    {
        return view();
    }

    public function urlajax()
    {
        // $data=$_POST;
        $title=input('title');
        $d=input('domain');
        $res=Db::execute(" UPDATE ch_annx as a ,ch_article as b , ch_cate as c , ch_banner as d , ch_thumb as e SET a.picsrc = REPLACE ( a.picsrc,'" .$title."', '".$d."'), b.thumb = REPLACE ( b.thumb,'" .$title."', '".$d."') , b.url = REPLACE ( b.url,'" .$title."', '".$d."') , b.content = REPLACE ( b.content,'" .$title."', '".$d."') ,  c.url = REPLACE ( c.url,'" .$title."', '".$d."') , d.thumb = REPLACE ( d.thumb,'" .$title."', '".$d."') , d.url = REPLACE ( d.url,'" .$title."', '".$d."') , e.thumb = REPLACE ( e.thumb,'" .$title."', '".$d."') , e.content = REPLACE ( e.content,'" .$title."', '".$d."')");
        return json_encode([
            'status'=>1,
            ]);
    }
}
